package com.boss.oss.controller;

import java.io.File;
import java.util.List;
import com.boss.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author  Hu_liantiam
 * @date 2020/7/28
 */
@RestController
@RequestMapping()
public class OssController {

    @Autowired
    OssService ossService;

    @RequestMapping("/insertFile")
    public void insertFile(@RequestBody File file){
        ossService.insertFile(file);
    }

    @RequestMapping("/queryFile")
    public List queryFile() throws InterruptedException {
        return ossService.queryFile();
    }

    @RequestMapping("/removeFile")
    public void removeFile(@RequestBody String fileName){
        ossService.removeFile(fileName);
    }

    @RequestMapping("/downloadFile")
    public void downloadFile(@RequestBody String fileName, @RequestBody File file){
        ossService.downloadFile(fileName, file);
    }

}
